package com.naml.g_buffered;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * @author marin
 * @version 1.0
 * @date 2025/4/23 20:49
 * @desc 演示 BufferedWriter 的使用
 */
@SuppressWarnings("all")
public class BufferedWriter02 {
    public static void main(String[] args) {
        String path = "/Users/marin/new3.txt";
        //try-with-resources 自动资源管理--自动关闭实现 AutoCloseable 接口的资源，避免手动 finally 块
        try (BufferedWriter bw = new BufferedWriter(new FileWriter(path,true))) {
            bw.write("张涛洪你要发财啦");
            bw.newLine();//换行
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
